﻿#region Legal notice
/*
 * This file is part of EPPLib.
 * Copyright 2010, 2011 
 * Gianluca Esposito (info@gianlucaesposito.it)
 * ----------------------------------------------------------------------------
 * EPPLib is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 * 
 * EPPLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with Nome-Programma; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#endregion

#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Xml.Serialization;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using EPPLib.Objects;
#endregion

namespace EPPLib.Messages
{
    [Serializable]
    [XmlType(Namespace = "http://www.nic.it/ITNIC-EPP/extcon-1.0", TypeName = "extcon")]
    [XmlRoot(ElementName = "create", Namespace = "http://www.nic.it/ITNIC-EPP/extcon-1.0")]
    public class CreateExtendedContactMessage : BaseMessage, IMessage
    {
        #region Members
        private bool _consentForPublishing;
        private RegistrantObject _registrant;

        [XmlAttribute("schemaLocation", Namespace = XmlSchema.InstanceNamespace)]
        public string xsiSchemaLocation = "http://www.nic.it/ITNIC-EPP/extcon-1.0 extcon-1.0.xsd";
        [XmlNamespaceDeclarations]
        public XmlSerializerNamespaces xmlns;
        #endregion

        #region Properties
        [XmlElement(ElementName = "consentForPublishing")]
        public bool ConsentForPublishing { get { return _consentForPublishing; } set { _consentForPublishing = value; } }

        [XmlElement(ElementName = "registrant")]
        public RegistrantObject Registrant { get { return _registrant; } set { _registrant = value; } }

        [XmlIgnoreAttribute()]
        public bool RegistrantSpecified { get { return !string.IsNullOrEmpty(_registrant.NationalityCode) && !string.IsNullOrEmpty(_registrant.TaxCode) && _registrant.EntityType > 0; } }
        #endregion

        #region Constructor(s)
        public CreateExtendedContactMessage()
        {
            xmlns = new XmlSerializerNamespaces();
            xmlns.Add("extcon", "http://www.nic.it/ITNIC-EPP/extcon-1.0");
            _consentForPublishing = false;
            _registrant = new RegistrantObject();
        }
        #endregion
    }
}